package com.htht.smartschool.action.maintain;

import java.util.Map;

import com.htht.smartschool.action.baseaction.BaseAction;
import com.htht.smartschool.common.model.ParamData;
import com.htht.smartschool.common.servlet.DataContainer;
import com.htht.smartschool.service.maintain.MaintainService;

public class MaintainAction extends BaseAction {

	@SuppressWarnings("rawtypes")
	@Override
	public boolean processData(DataContainer obj, ParamData pd) {
		MaintainService eChartsService = new MaintainService();
		boolean flag = false;
		if(pd.getCmd().equalsIgnoreCase("bar")){
			Map map = eChartsService.getBarChart();
			if(map!=null&&map.size()>0){
				flag = true;
				obj.setData(map);
			}else{
				obj.setData("查无数据！");
			}
		}else if(pd.getCmd().equalsIgnoreCase("pie")){
			Map map = eChartsService.getUserChart();
			if(map!=null&&map.size()>0){
				flag = true;
				obj.setData(map);
			}else{
				obj.setData("查无数据！");
			}
		}else if(pd.getCmd().equalsIgnoreCase("teacher_bar")){
			Map map = eChartsService.getSchoolChart();
			if(map!=null&&map.size()>0){
				flag = true;
				obj.setData(map);
			}else{
				obj.setData("查无数据！");
			}
		}else if(pd.getCmd().equalsIgnoreCase("getSchoolCount")){
			int schoolCount = eChartsService.getSchoolCount();
			if(schoolCount >= 0){
				flag = true;
				obj.setData(schoolCount);
			}else{
				obj.setData("查无数据！");
			}
		}
		return flag;
	}

}
